package com.shushan.mixedexam.oralcalculation.bean;

import com.android.net.bean.NetBaseBean;
import com.shushan.base.Constants;
import com.shushan.pages.bean.TopicBean;

import org.json.JSONException;
import org.json.JSONObject;

/**
 * @ClassName: OralCalculateExerciseListBean
 * @Desciption: //口算练习列表数据bean
 * @author: zhangshihao
 * @date: 2018-08-15
 */
public class OralCalculateExerciseListBean extends NetBaseBean {

    public OCsubjectBean oCsubjectBean;

    public int progress_lock;

    public int total;//总时长，单位：分钟
    public int num;//total时间内完成题数
    public int time;//完成后奖励的时间，单位：分钟

    @Override
    public void initByJson(JSONObject jsonObject) throws JSONException {
        if(jsonObject == null){
            return;
        }
        progress_lock = jsonObject.optInt("progress_lock",0);

        JSONObject ocObj = jsonObject.optJSONObject("subject");
        if(ocObj != null) {
            JSONObject mathObj = ocObj.optJSONObject(Constants.SUBJECT_MACH_ID + "");
            oCsubjectBean = new OCsubjectBean();
            oCsubjectBean.initByJson(mathObj);
        }

        JSONObject rewardObj = jsonObject.optJSONObject("reward");
        if(rewardObj != null){
            total = rewardObj.optInt("total",0);
            num = rewardObj.optInt("num",0);
            time = rewardObj.optInt("time",0);
        }
    }
}
